package org.crystal.tradecraft.model.binance.market;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.Data;
import org.crystal.tradecraft.model.binance.enumeration.OrderType;
import org.crystal.tradecraft.model.binance.enumeration.Permission;
import org.crystal.tradecraft.model.binance.enumeration.STPMode;
import org.crystal.tradecraft.model.binance.enumeration.SymbolStatus;
import org.crystal.tradecraft.model.binance.market.filter.BinanceFilter;
import org.crystal.tradecraft.serialization.BinanceFiltersDeserializer;

import java.util.List;
import java.util.Set;

/**
 * Please refer {@link https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api#%E4%BA%A4%E6%98%93%E8%A7%84%E8%8C%83%E4%BF%A1%E6%81%AF}
 */
@Data
public class Symbol {

    private String symbol;

    private SymbolStatus status;

    private String baseAsset;

    private Integer baseAssetPrecision;

    private String quoteAsset;

    private Integer quotePrecision;

    private Integer quoteAssetPrecision;

    private Integer baseCommissionPrecision;

    private Integer quoteCommissionPrecision;

    private Set<OrderType> orderTypes;

    private Boolean icebergAllowed;

    private Boolean ocoAllowed;

    private Boolean otoAllowed;

    private Boolean quoteOrderQtyMarketAllowed;

    private Boolean allowTrailingStop;

    private Boolean cancelReplaceAllowed;

    private Boolean isSpotTradingAllowed;

    private Boolean isMarginTradingAllowed;

    @JsonDeserialize(using = BinanceFiltersDeserializer.class)
    private List<? extends BinanceFilter> filters;

    private Set<Permission> permissions;

    private List<Set<Permission>> permissionSets; // refer to https://developers.binance.com/docs/zh-CN/binance-spot-api-docs/rest-api#%E8%A7%A3%E9%87%8A%E5%93%8D%E5%BA%94%E4%B8%AD%E7%9A%84-permissionsets%EF%BC%9A

    private STPMode defaultSelfTradePreventionMode;

    private Set<STPMode> allowedSelfTradePreventionModes;
}
